on open fileDropList
	set theCount to count of fileDropList
	set filesProcessed to 0
	tell application "MacGS-510 FAT" to activate
	repeat with i from 1 to theCount
		set theFile to item i of fileDropList as alias
		set theInfo to info for theFile
		set theType to file type of theInfo
		set theFileName to item i of fileDropList as string
		if theType = "TEXT" or theType = "PDF " or theType = "EPSF" then
			ProcessFiles(theFileName)
			set filesProcessed to filesProcessed + 1
		end if
	end repeat
	if filesProcessed > 0 then
		if filesProcessed is equal to 1 then
			set resultString to "One file was processed."
		else
			set resultString to {theCount, " files were processed."} as string
		end if
	else
		set resultString to {"No files were processed."} as string
	end if
	display dialog resultString buttons "OK" with icon 1 default button 1
end open

on ProcessFiles(theFile)
	set thePCLfile to {theFile, ".pcl"} as string
	set theCommandLine to {"-sDEVICE=ljet3d -q -dNOPAUSE -dSAFER  -sOutputFile=\"", thePCLfile, "\" -dduplex -- \"", theFile, "\" -c quit"} as string
	tell application "MacGS-510 FAT"
		Çevent gsVRexecÈ theCommandLine
	end tell
	
	set thePCLfileAlias to thePCLfile as alias
	tell application "lpr thing"
		open thePCLfileAlias
	end tell
end ProcessFiles

on run
	set theFile to (choose file of type {"TEXT", "EPSF", "PDF "}) as string
	ProcessFiles(theFile)
end run
